<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/pages/common/taglib.jsp" %>
<!DOCTYPE html>
<html>
  <head>
	<!--声明当前页面的编码集：charset=gbk,gb2312(中文编码)，utf-8国际编码-->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<!--当前页面的三要素-->
	<title>陇上无限学——陇南情Malron</title>
	<meta name="Keywords" content="关键词,关键词">
	<meta name="description" content="">
	<link rel="icon" href="${basePath}/resources/images/tmtitle.png">
	<link rel="icon" href="${basePath}/resources/images/tmtitle.png" type="image/x-icon" />
	<style type="text/css">
		body{ background:#2b9c6b; color:#2f3437; font-size:12px;}
		.login_bt{width:100%; height:30%;margin:15% auto;position:relative;}
		.login_logo{ width:450px; height:40px;margin-left:42%;font-size: 24px;position: absolute;top:-50px;}
		.messagebox{position:absolute;left: 44%;height:40px;bottom:0px;}
		.messagebox .message{height:40px;text-align:center;color:red;font-size:16px;}
		.login_nr{ width:100%; height:300px;}
		.login_zi{ width:316px; margin:0 auto;}
		.tishi{ width:100%; height:55px; line-height:55px; color:#ffffff;}
		.tishi span{ display:block; width:16px; height:16px; margin-top:20px; float:left;}
		.tishi p{ float:left; padding-left:5px;}
		.box{ width:100%; height:44px; margin-bottom:8px; background:#d3d5dc;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius: 6px;}
		.user_box{ width:252px; height:44px; line-height:44px; padding-left:12px; border:0px; background:none; float:left;}
		.user_pic{ width:52px; height:44px; background:url(${basePath}/resources/images/icon_username.png) no-repeat center; float:left;}
		.password_pic{ width:52px; height:44px; background:url(${basePath}/resources/images/icon_key.png) no-repeat center; float:left;}
		.submit_btn{ width:100%; height:44px; text-align:center; color:#ffffff; font-size:18px; border:0px; background:#28b779;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius: 6px; cursor:pointer;}
	</style>
<%@include file="/WEB-INF/pages/common/common.jsp"%>
</head>
<body>
 <div class="login_bt">
     <div class="login_logo">管理系统登录界面</div>
     <div class="messagebox"><span class="message"></span></div>
     <div class="login_nr">
          <div class="login_zi">
               <div class="box">
                    <input name="account" id="account" type="text" class="user_box" autofocus="autofocus" placeholder="请输入账号……" />
                    <div class="user_pic"></div>
               </div>
               <div class="box">
                    <input name="password" id="password" type="password" class="user_box" placeholder="请输入密码……" />
                    <div class="password_pic"></div>
               </div> 
               <div class="clearfix"></div>
               <input name="" type="button" onclick="tz_admin_login(this)" class="submit_btn" value="登 录" />
          </div>
     </div>
 </div>

<script type="text/javascript">

 	$(function(){
 		//按下Enter建触发登陆按钮
 		$(document).keydown(function(e){
 			if(e.keyCode==13){
 				tz_admin_login();
 			}
 		});
 	 	
 	 	$("#account").keyup(function(){
 	 		tzMap.put("marlon_admAccount",$(this).val(),1);
 	 	});
 		
 	 	var username = tzMap.get("marlon_admAccount",1);
 	 	if(username) $("#account").val(username);
 	});
	//登陆功能的实现
	function tz_admin_login(){
		var account = $("#account").val();//获取输入的帐号
		var password = $("#password").val();//获取输入的密码
		var params = {"account":account,"password":password};//参数传递
		 $.ajax({
			 type:"post",
			 url:basePath+"/logined",
			 data:params,
			 success:function(data){
				 var jdata = data.trim();
				 if(jdata=="error"||jdata=="null"){//输入信息为空或错误
					 //输入信息为空或错误提示消息
					 loading("please fill account and password!",4);
					 $("#account").select();
					 $("#password").val("");
				 }else if(jdata=="fail"){//登录失败
					 loading("account and password! is error!",4);
					 $("#account").select();
					 $("#password").val("");
				 }else{//登录成功
					 loading("Welcome to index!!!",1);
					 window.location.href = adminPath + "/index";
				 }
			 }
		 });
	}  
</script>
</body>
</html>